'use strict';

/**
 * Config for the router
 */
angular.module('app')
    .run(
        ['$rootScope', '$state', '$stateParams',
            function ($rootScope, $state, $stateParams) {
                $rootScope.$state = $state;
                $rootScope.$stateParams = $stateParams;
            }
        ]
    )
    .config(
        ['$stateProvider', '$urlRouterProvider',
            function ($stateProvider, $urlRouterProvider) {

                $urlRouterProvider
                    .otherwise('/app/bksb');
                $stateProvider
                    .state('app', {
                        abstract: true,
                        url: '/app',
                        templateUrl: 'tpl/app.html'
                    })
                    //==================================
                    .state('app.bksb', {
                        url: '/bksb',
                        templateUrl: 'tpl/bksb.html',
                        resolve: {
                            deps: ['$ocLazyLoad',
                                function ($ocLazyLoad) {
                                    return $ocLazyLoad.load(['js/controllers/bksb.js']);
                                }]
                        }
                    })
                    .state('app.txsh', {
                        url: '/txsh',
                        templateUrl: 'tpl/txsh.html'
                    })
                    .state('app.sqsb', {
                        url: '/sqsb',
                        templateUrl: 'tpl/sqsb.html',
                        resolve: {
                            deps: ['$ocLazyLoad',
                                function ($ocLazyLoad) {
                                    return $ocLazyLoad.load(['js/controllers/sqsb.js']);
                                }]
                        }
                    })

                    .state('app.zzmgsb', {
                        url: '/zzmgsb',
                        templateUrl: 'tpl/zzmgsb.html',
                        resolve: {
                            deps: ['$ocLazyLoad',
                                function ($ocLazyLoad) {
                                    return $ocLazyLoad.load(['js/controllers/zzmgsb.js']);
                                }]
                        }
                    })
                    .state('app.extxsb', {
                        url: '/extxsb',
                        templateUrl: 'tpl/extxsb.html',
                        resolve: {
                            deps: ['$ocLazyLoad',
                                function ($ocLazyLoad) {
                                    return $ocLazyLoad.load(['js/controllers/extxsb.js']);
                                }]
                        }
                    })
                    .state('app.gifsq', {
                        url: '/gifsq',
                        templateUrl: 'tpl/gifsq.html',
                        resolve: {
                            deps: ['$ocLazyLoad',
                                function ($ocLazyLoad) {
                                    return $ocLazyLoad.load(['js/controllers/gifsq.js']);
                                }]
                        }
                    })
                    .state('app.gzrw', {
                        url: '/gzrw',
                        templateUrl: 'tpl/gzrw.html',
                        resolve: {
                            deps: ['$ocLazyLoad',
                                function ($ocLazyLoad) {
                                    return $ocLazyLoad.load(['js/controllers/gzrw.js']);
                                }]
                        }
                    })
                    .state('app.ggjc', {
                        url: '/ggjc',
                        templateUrl: 'tpl/ggjc.html',
                        resolve: {
                            deps: ['$ocLazyLoad',
                                function ($ocLazyLoad) {
                                    return $ocLazyLoad.load(['js/controllers/ggjc.js']);
                                }]
                        }
                    })
                    .state('app.twsh', {
                        url: '/twsh',
                        templateUrl: 'tpl/twsh.html',
                        resolve: {
                            deps: ['$ocLazyLoad',
                                function ($ocLazyLoad) {
                                    return $ocLazyLoad.load(['js/controllers/twsh.js']);
                                }]
                        }
                    })
                    .state('app.touxiangsh', {
                        url: '/touxiangsh',
                        templateUrl: 'tpl/touxiangsh.html',
                        resolve: {
                            deps: ['$ocLazyLoad',
                                function ($ocLazyLoad) {
                                    return $ocLazyLoad.load(['js/controllers/touxiangsh.js']);
                                }]
                        }
                    })
                    .state('app.txzl', {
                        url: '/txzl',
                        templateUrl: 'tpl/txzl.html',
                        resolve: {
                            deps: ['$ocLazyLoad',
                                function ($ocLazyLoad) {
                                    return $ocLazyLoad.load(['js/controllers/txzl.js']);
                                }]
                        }
                    })
                //==================================

            }
        ]
    );